package cn.iocoder.yudao.module.energy.controller.admin.statistics;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.energy.controller.admin.statistics.vo.StatisticsRespVO;
import cn.iocoder.yudao.module.energy.service.statistics.StatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Tag(name = "管理后台 - 能源统计")
@RestController
@RequestMapping("/energy/statistics")
@Validated
public class StatisticsController {

    @Resource
    private StatisticsService statisticsService;

    @GetMapping("")
    @Operation(summary = "获取能源统计数据")
    @PreAuthorize("@ss.hasPermission('energy:statistics:query')")
    public CommonResult<StatisticsRespVO> getStatistics() {
        return CommonResult.success(statisticsService.getStatistics());
    }
} 